package com.jbm.enterapplication.view;

import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.jbm.enterapplication.R;


/**
 * 李征
 * Created by 家帮忙 on 2017/1/13.
 */

public class DoubleButtonDialog {
    AlertDialog al;
     TextView message,Title_message;
     Button buttonok,buttonno;
    Context context;
    public DoubleButtonDialog(Context context, String str) {
        this.context = context;
        al = new AlertDialog.Builder(context, R.style.dialog).create();
        al.setCancelable(false);
        View view= View.inflate(context, R.layout.doublebuttondialog,null);
        al.setView(view);
        al.show();
         message = (TextView) view.findViewById(R.id.message);
        message.setText(str);
        Title_message = (TextView) view.findViewById(R.id.tetle_message);
        buttonok =(Button)view.findViewById(R.id.buttonok);
        buttonno=(Button) view.findViewById(R.id.buttonno);
    }
    //接收消息
    public void setMessage(String mess){
        message.setText(mess);

    }
    //接收标题和消息
    public void setTetle_message(String titmessage) {
        Title_message.setText(titmessage);

    }


//设置按钮
    public void setOkText(CharSequence text) {
        buttonok.setText(text);
    }

    public void setNoText(CharSequence text) {
        buttonno.setText(text);
    }
//设置监听
    public View getokbtn() {
        return buttonok;
    }

    public View getnobtn() {
        return buttonno;
    }
    //设置消息可见性
    public void setisVisibilitymess(){
        Title_message.setVisibility(View.VISIBLE);
    }
   //设置按钮可见性
    public void setisVisibility(){
        buttonno.setVisibility(View.GONE);
    }
    /**
     * 关闭对话框
     */

    public void dismiss() {al.dismiss();

    }
}
